from django.shortcuts import render
from rest_framework.response import Response
from rest_framework.views import APIView
from home import models, homeser




# Create your views here.
class TopNav(APIView):
    def get(self, request):
        topnav = models.NavModel.objects.filter(is_del=1, position=True).order_by("order")
        ser = homeser.NavSer(topnav, many=True)
        return Response({"msg": "ok", "code": 200, "data": ser.data})
class FootNav(APIView):
    def get(self, request):
        footnav = models.NavModel.objects.filter(is_del=1, position=False).order_by("order")
        ser = homeser.NavSer(footnav, many=True)
        return Response({"msg": "ok", "code": 200, "data": ser.data})